package com.ysx.article.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ysx.article.mapper.ApAuthorMapper;
import com.ysx.article.pojo.ApAuthor;
import com.ysx.article.service.ApAuthorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * APP文章作者信息表 服务实现类
 * </p>
 *
 * @author ljh
 * @since 2021-09-08
 */
@Service
public class ApAuthorServiceImpl extends ServiceImpl<ApAuthorMapper, ApAuthor> implements ApAuthorService {
    @Autowired
    private ApAuthorMapper apAuthorMapper;

    //根据用户id查询作者账号
    @Override
    public ApAuthor selectByUserId(Integer userId) {
        QueryWrapper<ApAuthor> apAuthorQueryWrapper = new QueryWrapper<>();
        apAuthorQueryWrapper.eq("user_id", userId);
        ApAuthor apAuthor = apAuthorMapper.selectOne(apAuthorQueryWrapper);
        return apAuthor;
    }
}
